import java.util.Scanner;
import java.util.Arrays;
public class test10 {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        int[][] array = new int[n][n];
        for(int i = 0 ; i < n ; i++) {
            for(int j = 0 ; j < n ; j++) {
                array[i][j] = sc.nextInt();
                if(i > j && array[i][j] == 0) {
                    count++;
                }
            }
        }
        if(count == n*(n-1) / 2) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
    public static void main13(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for(int i = 0 ; i < n ; i++) {
            array[i] = sc.nextInt();
        }
        boolean isChong = false;
        for(int i = 0 ; i < n ; i++) {
            for(int j = 0 ; j < i ; j++) {
                if(array[i] == array[j]){
                    isChong = true;
                    break;
                } else {
                    isChong = false;
                }
            }
            if(!isChong) {
                System.out.print(array[i] + " ");
            }
        }
    }
    public static void main12(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a=new int[10];
        int positive=0,negative=0;
        for(int i=0;i<10;i++)
        {
            a[i]=sc.nextInt();
            if(a[i]>0)
            {
                positive++;
            }else{
                negative++;
            }
        }
        System.out.println("positive:"+positive+"\n"+"negative:"+negative);
    }
    public static void main1(String[] args) {
        Scanner sc=new Scanner(System.in);
        int m=sc.nextInt();
        int n=sc.nextInt();
        int[][] array=new int[m][n];
        int[][] brray=new int[m][n];
        double count=0.0;
        for(int i=0;i<m;i++)
        {
            for(int j=0;j<n;j++)
            {
                array[i][j]=sc.nextInt();
            }
        }
        for(int i=0;i<m;i++)
        {
            for(int j=0;j<n;j++)
            {
                brray[i][j]=sc.nextInt();
            }
        }
        for(int i=0;i<m;i++)
        {
            for(int j=0;j<n;j++)
            {
                if(array[i][j]==brray[i][j])
                {
                    count++;
                }
            }
        }
        System.out.printf("%.2f",(count)/(m*n)*100);
    }


    public static void main10(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNextInt()) {
            int time = scan.nextInt();
            if(time > 0) {
                System.out.println(1);
            } else if(time == 0) {
                System.out.println(0.5);
            } else {
                System.out.println(0);
            }

        }
    }

    public static void main9(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] arr = new int[n + 1];
        int index = 0;
        for(int i = 0; i < n; i++) {
            arr[i] = scan.nextInt();
        }
        arr[n] = scan.nextInt();
        Arrays.sort(arr);
        for(int i = 0; i <= n; i++) {
            System.out.print(arr[i] + " ");
        }
    }

    public static void main8(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = scan.nextInt();
        }
        int deleteNum = scan.nextInt();
        for(int i = 0; i < n; i++) {
            if(arr[i] != deleteNum) {
                System.out.print(arr[i] + " ");
            }
        }
    }

    public static void main7(String[] args) {

        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()) {
            int n = sc.nextInt();
            for(int i = 1 ; i <= n ; i++) {
                for(int j = 1 ; j <= i ; j++) {
                    System.out.print(j + " ");
                }
                System.out.println();
            }
        }
    }


    public static void main6(String[] args){
        Scanner sin = new Scanner(System.in);
        long year = sin.nextLong();
        int day = sin.nextInt();
        int month = sin.nextInt();
        TDate td = new TDate(month,day,year);
        td.prints();

    }
}



        class TDate{
    private int Month = 0;  // 日
    private int Day = 0; // 月
    private long Year = 0; // 年

    TDate(int Month,int Day,long Year){
        this.Month = Month;
        this.Day = Day;
        this.Year = Year;
    }

    public void prints(){
        System.out.println(Month + "/" + Day + "/" + Year);
    }

    public static void main5(String[] args){
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String[] scores = str.split(" ");
        int sum = 0;
        for(String score : scores){
            sum += Integer.parseInt(score);
        }
        double average = sum / 5.0;
        System.out.printf("%.1f", average);
    }



    public static void main4(String[] args) {

        Scanner sc = new Scanner(System.in);
        int score = sc.nextInt();
        if(score >= 10) {
            System.out.println("Danger++");
        } else if(score >= 4 && score <= 9) {
            System.out.println("Danger");
        } else {
            System.out.println("Good");
        }
    }

        public static int fibo(int n){
            if(n==1){
                return 0;
            }else if(n==2){
                return 1;
            }
            else return fibo(n-1)+fibo(n-2);
        }
        public static void main1(String[] args) {
            Scanner sc=new Scanner(System.in);
            int n=sc.nextInt();
            int a =fibo(n);
            System.out.println(a);
        }
        public static void main2(String[] args){
            Scanner sc=new Scanner(System.in);
            int n=sc.nextInt();
            ht(n,'a','b','c');
            sc.close();
        }
        public static void ht(int n,char a,char b,char c){
            if(n==1){
                System.out.println(a+"->"+c);
            }else{
                ht(n-1,a,c,b);
                System.out.println(a+"->"+c);
                ht(n-1,b,a,c);
            }
        }
    }
